﻿using System;
using System.Web;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
namespace MSVSTS.Common
{
    /// <summary>
    /// 应用程序配置类。
    /// </summary>
    public sealed class AppConfiguration
    {
        public AppConfiguration()
        {

        }

        /// <summary>
        /// 应用程序 Url 后缀。
        /// </summary>
        private static string UrlSuffix
        {
            get
            {
                string s = HttpContext.Current.Request.Url.Host + HttpContext.Current.Request.ApplicationPath;
                if (s.EndsWith("/"))
                    s = s.Substring(0, s.Length - 1);
                if (ConfigurationManager.AppSettings["UsePort"] == "1")
                    s = s + ":" + ConfigurationManager.AppSettings["Port"];
                return s;
            }
        }

        /// <summary>
        /// 应用程序 Url 基部。
        /// </summary>
        public static String UrlBase
        {
            get
            {
                return @"http://" + UrlSuffix;
            }
        }

        /// <summary>
        /// 数据库的数据连接字符串。
        /// </summary>
        public static String ConnectionString
        {
            get
            {
                //return ConfigurationManager.ConnectionStrings["ConnectionString"].ToString();
                return "Data Source=localhost;Initial Catalog=S_BookOnline;User ID=sa;password=fujie";
            }
        }

        /// <summary>
        /// 在线刷新的时间间隔。
        /// 以分钟为单位
        /// </summary>
        public static int OnlineSpacing
        {
            get
            {
                return int.Parse(ConfigurationManager.AppSettings["OnlineSpacing"]);
            }
        }

        /// <summary>
        /// 默认的分页大小。
        /// </summary>
        public static int Pagination
        {
            get
            {
                return int.Parse(ConfigurationManager.AppSettings["Pagination"]);
            }
        }

        /// <summary>
        /// 修改注册信息可得100分的判断时间。
        /// </summary>
        public static DateTime UpdateRegisterPageTime
        {
            get
            {
                return DateTime.Parse(ConfigurationManager.AppSettings["UpdateRegisterPageTime"]);
            }
        }

        /// <summary>
        /// 应用程序虚拟根目录路径：如 /MSDNWebcast
        /// </summary>
        public static string AppBasePath
        {
            get
            {
                if (HttpContext.Current.Request.ApplicationPath == "/")
                    return "";
                return HttpContext.Current.Request.ApplicationPath;
            }
        }

        /// <summary>
        /// 网站主页
        /// </summary>
        public static String Homepage
        {
            get
            {
                return AppBasePath + "/Default.aspx";
            }
        }

        /// <summary>
        /// 网站主页
        /// </summary>
        public static String Login
        {
            get
            {
                return AppBasePath + "/Login.aspx";
            }
        }

        /// <summary>
        /// 后台管理登陆页
        /// </summary>
        public static String AdminLoginPage
        {
            get
            {
                return AppBasePath + "/Admin/Admin_Login.aspx";
            }
        }

        /// <summary>
        /// 后台管理重登录页
        /// </summary>
        public static String AdminReLoginPage
        {
            get
            {
                return AppBasePath + "/Admin/Admin_Login.aspx";
            }
        }

        /// <summary>
        /// 网站错误页面
        /// </summary>
        public static String ErrorPage
        {
            get
            {
                return AppBasePath + "/Error.aspx";
            }
        }

        /// <summary>
        /// 密钥
        /// </summary>
        public static String EncryptKey
        {
            get
            {
                return "ArchitectCircle";
            }
        }

        /// <summary>
        /// 网站的虚拟目录名称
        /// </summary>
        public static String VirtualFolder
        {
            get
            {
                String s = HttpContext.Current.Request.ApplicationPath;
                if (s.Length > 1)
                {
                    s = s.Substring(1);
                }
                else
                {
                    s = "";
                }
                return s;
            }
        }

        public static String StyleUrl
        {
            get
            {
                return "Style/VSTS/";
            }
        }

        private static Queue<string> m_AllCheckBoxID=new Queue<string> ();
        public static Queue<string> AllCheckBoxID
        {
            get 
            {
                return m_AllCheckBoxID;
            }
            set
            {
                m_AllCheckBoxID.Enqueue(value.ToString());
            }
        
        }


    }
}
